package com.list_builder;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Person {

	private String firstName;
	private String lastName;
	private String gender;
	private Date dateOfBirth;
	private String favoriteColor;
	
	// I prefer to use constants since I only have to change one line if I need to change their value
	private final String FEMALE_STRING_SHORT = "F";
	private final String FEMALE_STRING = "Female";
	private final String MALE_STRING = "Male";
	
	public String getFirstName() {
		return firstName;
	}
	
	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
	
	public String getLastName() {
		return lastName;
	}
	
	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public String getGender() {
		return gender;
	}
	
	public void setGender(String gender) {
		
		if(gender.equals(FEMALE_STRING_SHORT) || gender.equals(FEMALE_STRING))
		{
			this.gender = FEMALE_STRING;
		}
		else
		{
			this.gender = MALE_STRING;
		}
	}
	
	public Date getDateOfBirth() {
		return dateOfBirth;
	}
	
	public void setDateOfBirth(Date dateOfBirth) {
		this.dateOfBirth = dateOfBirth;
	}

	public String getFavoriteColor() {
		return favoriteColor;
	}

	public void setFavoriteColor(String favoriteColor) {
		this.favoriteColor = favoriteColor;
	}
	
	@Override
	public String toString()
	{
		DateFormat formatter = new SimpleDateFormat("M/d/yyyy");
		
		return lastName + " " + firstName + " " + gender + " " + formatter.format(dateOfBirth) + " " + favoriteColor;
	}
}
